<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>计算器</title>
</head>
<body>

    <div id="div">
    	数值1：<input type="text" v-model="num1">
    	<br>
    	<input type="radio" v-model="a" name="s" value="+">+</input>
    	<input type="radio" v-model="a" name="s" value="-">-</input>
    	<input type="radio" v-model="a" name="s" value="*">*</input>
    	<input type="radio" v-model="a" name="s" value="/">/</input>
    	<br>
    	数值2：<input type="text" v-model="num2">
    	<br>
    	<button v-on:click="fn()">=</button>
    	<br>
    	等于：<input type="text" v-model="str">
    </div>
	<script src="vue.js"></script>
	<script>
		const vm=new Vue({
			el:"#div",
			data:{
				num1:'',
				num2:'',
				a:'',
				str:''
			},
			methods:{
				fn(){
					let n1=this.num1;
					let n2=this.num2;
					let a=this.a
					this.str = eval(n1 + a + n2)
				}
			}
		})
	</script>
	
</body>
</html>